<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="生产基地" prop="scjd">
        <el-input v-model="queryParams.scjd" placeholder="请输入生产基地" clearable size="small" @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="检查人" prop="jcrPerson">
        <el-input v-model="queryParams.jcrPerson" placeholder="请输入检查人" clearable size="small" @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="检查时间" prop="jcsj">
        <el-date-picker :editable="false" clearable size="small" v-model="queryParams.jcsj" type="date" value-format="yyyy-MM-dd" placeholder="选择检查时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="报表编号" prop="bbbh">
        <el-input v-model="queryParams.bbbh" placeholder="请输入报表编号" clearable size="small" @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['Productionline_foodsafety:foodsafety:add']">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['Productionline_foodsafety:foodsafety:edit']">修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['Productionline_foodsafety:foodsafety:remove']">删除</el-button>
      </el-col>
      <!-- <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['Productionline_foodsafety:foodsafety:export']"
          >导出</el-button
        >
      </el-col> -->
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="foodsafetyList" @selection-change="handleSelectionChange" max-height="550">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="序号" align="center" prop="id" />
      <el-table-column label="生产基地" align="center" prop="scjd" />

      <el-table-column label="检查时间" align="center" prop="jcsj" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.jcsj, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column label="报表编号" align="center" prop="bbbh" />
      <el-table-column label="检查人" align="center" prop="jcrPerson" />
      <!-- <el-table-column label="备注" align="center" prop="remark" /> -->
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" min-width="250px">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-view"
            @click="excelhandleView(scope.row)"
          >导出</el-button            >
          <el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)">查看</el-button>
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['Productionline_foodsafety:foodsafety:edit']">修改</el-button>
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['Productionline_foodsafety:foodsafety:remove']">删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />

    <!-- 添加或修改食品安全自查对话框 -->
    <el-dialog fullscreen :title="title" :visible.sync="open" append-to-body custom-class="myDialog">
      <TableHeader @nameChange="nameChange" :data="{
          mainTitle: '食品安全自查表',
          company: '青岛崂山矿泉水有限公司',
          code: form.bbbh,
        }" />
      <div class="vx_table_box">
        <!-- <RowcolTableVxeTableDit
          :tableData="tableData2"
          :reverse="true"
          class="fiexd"
          style="width: 500px"
        /> -->
        <!-- <el-divider content-position="center">食品安全自查2信息</el-divider> -->
        <!-- <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddQualityProdFoodsafetySub" :disabled="openDisabled">添加</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteQualityProdFoodsafetySub" :disabled="openDisabled">删除</el-button>
          </el-col>
        </el-row> -->
        <el-form ref="form" :model="form" :rules="rules" label-width="90px" class="float" style="width:100%">
          <el-table :data="qualityProdFoodsafetySubList" :row-class-name="rowQualityProdFoodsafetySubIndex" ref="qualityProdFoodsafetySub" :span-method="objectSpanMethod" border>
            <!-- <el-table-column type="selection" width="50" align="center" /> -->
            <!-- <el-table-column label="序号" align="center" prop="name" width="50"/> -->
            <el-table-column label="内容" prop="nr" width="160" />
            <el-table-column label="检查项目" prop="jcxm" width="160">
            </el-table-column>
            <el-table-column label="检查原则" prop="jcyz" minWidth="700">
              <template slot-scope="scope">
                <!-- <el-input v-model="scope.row.jcyz" placeholder="请输入检查原则" :disabled="openDisabled"/> -->
                <!-- <template slot-scope="scope"> -->
                <el-select v-model="scope.row.jcyz" placeholder="请选择检查内容" style="width: 100%" :disabled="openDisabled">
                  <el-option v-for="dict in Productionline_FoodSafety" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue"></el-option>
                </el-select>
              </template>
              <!-- </template> -->
            </el-table-column>
            <el-table-column label="结论" prop="jl" width="120">
              <template slot-scope="scope">
                <!-- <el-input v-model="scope.row.jl" placeholder="请输入结论" :disabled="openDisabled"/> -->
                <el-select v-model="scope.row.jl" :disabled="openDisabled">
                  <el-option value="合格">合格</el-option>
                  <el-option value="不合格">不合格</el-option>
                </el-select>
              </template>
            </el-table-column>
            <el-table-column label="问题" prop="wt" minWidth="200">
              <template slot-scope="scope">
                <el-input type="textarea" v-model="scope.row.wt" placeholder="请输入问题" :disabled="openDisabled" />
              </template>
            </el-table-column>
            <!-- <el-table-column label="备注" prop="remark">
            <template slot-scope="scope">
                <el-input type="textarea" v-model="scope.row.remark" placeholder="请输入备注" :disabled="openDisabled"/>
            </template>
          </el-table-column> -->
            <el-table-column label="整改" prop="zg" minWidth="200">
              <template slot-scope="scope">
                <el-input type="textarea" v-model="scope.row.zg" placeholder="请输入整改" :disabled="openDisabled" />
              </template>
            </el-table-column>
            <el-table-column label="验证" prop="yz" width="120">
              <template slot-scope="scope">
                <!-- <el-input v-model="scope.row.yz" placeholder="请输入验证" :disabled="openDisabled"/> -->
                <el-select v-model="scope.row.yz" :disabled="openDisabled">
                  <el-option value="合格">合格</el-option>
                  <el-option value="不合格">不合格</el-option>
                </el-select>
              </template>
            </el-table-column>
            <!-- <el-table-column label="主表主键" prop="parentid">
            <template slot-scope="scope">
                <el-input v-model="scope.row.parentid" placeholder="请输入主表主键" :disabled="openDisabled"/>
            </template>
          </el-table-column> -->
          </el-table>

          <el-row>
            <el-col :span="8">
              <el-form-item label="生产基地" prop="scjd">
                <el-input v-model="form.scjd" placeholder="请输入生产基地" :disabled="openDisabled" />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="检查人" prop="jcrPerson">
                <!-- <el-input
                  v-model="form.jcrPerson"
                  placeholder="请输入检查人"
                  :disabled="openDisabled"
                /> -->
                <el-select v-model="form.jcrPerson" filterable allow-create placeholder="请选择检查人" style="width: 100%" :disabled="openDisabled">
                  <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" :value="item.nickName"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="检查时间" prop="jcsj">
                <el-date-picker :editable="false" clearable size="small" v-model="form.jcsj" type="date" value-format="yyyy-MM-dd" placeholder="选择检查时间" :disabled="openDisabled">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <!-- <el-col :span="12">
                <el-form-item label="报表编号" prop="bbbh">
                  <el-input v-model="form.bbbh" placeholder="请输入报表编号" :disabled="openDisabled" />
                </el-form-item>
            </el-col> -->
            <!-- <el-col :span="12">
                <el-form-item label="备注" prop="remark">
                  <el-input v-model="form.remark" placeholder="请输入备注" :disabled="openDisabled" />
                </el-form-item>
            </el-col> -->
          </el-row>
        </el-form>
      </div>
      <div slot="footer" class="dialog-footer" v-if="!openDisabled">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  listFoodsafety,
  getFoodsafety,
  delFoodsafety,
  addFoodsafety,
  updateFoodsafety,
} from "@/api/quality/productionline/foodsafety";
import { getInfo } from "@/api/login";
import { listUser } from "@/api/system/user";

export default {
  name: "Foodsafety",
  data() {
    return {
      /* 当前用户名 */
      nickName: "",
      userList: [],
      //弹窗是否禁止编辑
      openDisabled: true,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 子表选中数据
      checkedQualityProdFoodsafetySub: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 食品安全自查表格数据
      foodsafetyList: [],
      // 食品安全自查2表格数据
      qualityProdFoodsafetySubList: [],
      Productionline_FoodSafety: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 50,
        scjd: null,
        jcrPerson: null,
        jcsj: null,
        bbbh: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
    };
  },
  created() {
    this.getList();
    this.queryUserList();
    this.getDicts("Productionline_FoodSafety").then((response) => {
      this.Productionline_FoodSafety = response.data;
    });
  },
  methods: {
    /* 查询用户列表 */
    queryUserList() {
      listUser().then((response) => {
        this.userList = response.rows;
      });
      getInfo().then((response) => {
        this.nickName = response.user.nickName;
      });
    },
    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
      if (columnIndex === 0) {
        if (rowIndex === 0) {
          return {
            rowspan: 18,
            colspan: 1,
          };
        } else if (rowIndex === 18) {
          return {
            rowspan: 42,
            colspan: 1,
          };
        } else if (rowIndex === 60) {
          return {
            rowspan: 25,
            colspan: 1,
          };
        } else {
          return {
            rowspan: 0,
            colspan: 0,
          };
        }
      }
      if (columnIndex === 1) {
        if (rowIndex === 0) {
          return {
            rowspan: 7,
            colspan: 1,
          };
        } else if (rowIndex === 7) {
          return {
            rowspan: 3,
            colspan: 1,
          };
        } else if (rowIndex === 10) {
          return {
            rowspan: 2,
            colspan: 1,
          };
        } else if (rowIndex === 12) {
          return {
            rowspan: 2,
            colspan: 1,
          };
        } else if (rowIndex === 14) {
          return {
            rowspan: 1,
            colspan: 1,
          };
        } else if (rowIndex === 15) {
          return {
            rowspan: 3,
            colspan: 1,
          };
        } else if (rowIndex === 18) {
          return {
            rowspan: 5,
            colspan: 1,
          };
        } else if (rowIndex === 23) {
          return {
            rowspan: 5,
            colspan: 1,
          };
        } else if (rowIndex === 28) {
          return {
            rowspan: 6,
            colspan: 1,
          };
        } else if (rowIndex === 34) {
          return {
            rowspan: 2,
            colspan: 1,
          };
        } else if (rowIndex === 36) {
          return {
            rowspan: 2,
            colspan: 1,
          };
        } else if (rowIndex === 38) {
          return {
            rowspan: 2,
            colspan: 1,
          };
        } else if (rowIndex === 40) {
          return {
            rowspan: 2,
            colspan: 1,
          };
        } else if (rowIndex === 42) {
          return {
            rowspan: 5,
            colspan: 1,
          };
        } else if (rowIndex === 47) {
          return {
            rowspan: 4,
            colspan: 1,
          };
        } else if (rowIndex === 51) {
          return {
            rowspan: 5,
            colspan: 1,
          };
        } else if (rowIndex === 56) {
          return {
            rowspan: 4,
            colspan: 1,
          };
        } else if (rowIndex === 60) {
          return {
            rowspan: 7,
            colspan: 1,
          };
        } else if (rowIndex === 67) {
          return {
            rowspan: 2,
            colspan: 1,
          };
        } else if (rowIndex === 69) {
          return {
            rowspan: 3,
            colspan: 1,
          };
        } else if (rowIndex === 72) {
          return {
            rowspan: 2,
            colspan: 1,
          };
        } else if (rowIndex === 74) {
          return {
            rowspan: 4,
            colspan: 1,
          };
        } else if (rowIndex === 78) {
          return {
            rowspan: 2,
            colspan: 1,
          };
        } else if (rowIndex === 80) {
          return {
            rowspan: 5,
            colspan: 1,
          };
        } else {
          return {
            rowspan: 0,
            colspan: 0,
          };
        }
      }
    },
    /** 查询食品安全自查列表 */
    getList() {
      this.loading = true;
      listFoodsafety(this.queryParams).then((response) => {
        this.foodsafetyList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        scjd: null,
        jcrPerson: this.nickName,
        jcsj: null,
        bbbh: "LK-QG-LSB-05-009-17-A",
        remark: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        delFlag: null,
      };
      this.qualityProdFoodsafetySubList = [];
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.openDisabled = false;
      this.open = true;
      this.title = "添加食品安全自查表";
      this.form.scjd = "仰口生产基地";
      this.handleAddQualityProdFoodsafetySub();
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      this.openDisabled = false;
      const id = row.id || this.ids;
      getFoodsafety(id).then((response) => {
        this.form = response.data;
        this.qualityProdFoodsafetySubList =
          response.data.qualityProdFoodsafetySubList;
        this.open = true;
        this.title = "修改食品安全自查";
        this.initTable();
      });
    },
    /** 查看按钮 */
    handleView(row) {
      this.reset();
      this.openDisabled = true;
      const id = row.id || this.ids;
      getFoodsafety(id).then((response) => {
        this.form = response.data;
        this.qualityProdFoodsafetySubList =
          response.data.qualityProdFoodsafetySubList;
        this.open = true;
        this.title = "查看食品安全自查表";
        this.initTable();
        // console.log(this.qualityProdFoodsafetySubList)
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          this.form.qualityProdFoodsafetySubList =
            this.qualityProdFoodsafetySubList;
            /**打开遮罩层*/
            const rLoading = this.openLoading();
          if (this.form.id != null) {
            updateFoodsafety(this.form)
              .then((response) => {
                /**成功后执行关闭遮罩层*/
                rLoading.close();
                this.msgSuccess("修改成功");
                this.open = false;
                this.getList();
              })
              .catch((error) => {
                /**请求异常后执行关闭遮罩层*/
                rLoading.close();
              });
          } else {
            addFoodsafety(this.form)
              .then((response) => {
                /**成功后执行关闭遮罩层*/
                rLoading.close();
                this.msgSuccess("新增成功");
                this.open = false;
                this.getList();
              })
              .catch((error) => {
                /**请求异常后执行关闭遮罩层*/
                rLoading.close();
              });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$confirm(
        '是否确认删除食品安全自查编号为"' + ids + '"的数据项?',
        "警告",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }
      )
        .then(function () {
          return delFoodsafety(ids);
        })
        .then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 食品安全自查2序号 */
    rowQualityProdFoodsafetySubIndex({ row, rowIndex }) {
      row.index = rowIndex + 1;
    },
    /** 食品安全自查2添加按钮操作 */
    handleAddQualityProdFoodsafetySub() {
      for (let i = 1; i <= 85; i++) {
        let obj = {};
        obj.nr = "";
        if (i <= 16) {
          obj.nr =
            "原辅料（包括食品原料、食品添加剂、食品相关产品）采购进货查验落实情况。";
        } else if (i <= 58) {
          obj.nr = "生产过程控制";
        } else if (i <= 85) {
          obj.nr = "出厂检验现场检查";
        }

        obj.jcxm = "";
        if (i <= 7) {
          obj.jcxm = "1.原辅料存放";
        } else if (i <= 10) {
          obj.jcxm = "2.专库管理";
        } else if (i <= 12) {
          obj.jcxm = "3.标签标识";
        } else if (i <= 14) {
          obj.jcxm = "4.索证";
        } else if (i <= 15) {
          obj.jcxm = "5.制度具备情况";
        } else if (i <= 18) {
          obj.jcxm = "6.现场记录";
        } else if (i <= 23) {
          obj.jcxm = "1.厂区环境清洁卫生状况";
        } else if (i <= 28) {
          obj.jcxm = "2.卫生间、更衣室";
        } else if (i <= 34) {
          obj.jcxm = "3.生产加工场所清洁卫生状况、工作纪律";
        } else if (i <= 36) {
          obj.jcxm = "4.生产加工设施、设备清洁卫生状况";
        } else if (i <= 38) {
          obj.jcxm = "5.企业必备生产设备、设施维护保养和清洗消毒";
        } else if (i <= 40) {
          obj.jcxm = "6.产品投料记录";
        } else if (i <= 42) {
          obj.jcxm = "7.生产工艺和生产加工过程中关键控制点的控制记录";
        } else if (i <= 47) {
          obj.jcxm =
            "8.生产中人流、物流交叉污染情况；原料、半成品、成品交叉污染情况";
        } else if (i <= 51) {
          obj.jcxm = "9.设备、设施运行情况";
        } else if (i <= 56) {
          obj.jcxm = "10.从业人员管理情况";
        } else if (i <= 60) {
          obj.jcxm = "11.回收食品处置情况";
        } else if (i <= 67) {
          obj.jcxm = "1.检验室设施、设备、化学试剂情况";
        } else if (i <= 69) {
          obj.jcxm = "2.应具备相应能力的检验员";
        } else if (i <= 72) {
          obj.jcxm = "3.出厂销售成品是否具有出厂检验";
        } else if (i <= 74) {
          obj.jcxm = "4.产品留样情况";
        } else if (i <= 78) {
          obj.jcxm = "5.成品库成品存放是否符合要求";
        } else if (i <= 80) {
          obj.jcxm = "6.标识标注情况";
        } else if (i <= 85) {
          obj.jcxm = "7.不合格品管理和不安全食品召回情况";
        }
        obj.jcyz = i + "";
        obj.jl = "合格";
        obj.wt = "";
        obj.remark = "";
        obj.zg = "";
        obj.yz = "";
        // obj.parentid = "";
        this.qualityProdFoodsafetySubList.push(obj);
      }
    },
    /** 食品安全自查2删除按钮操作 */
    handleDeleteQualityProdFoodsafetySub() {
      if (this.checkedQualityProdFoodsafetySub.length == 0) {
        this.$alert("请先选择要删除的食品安全自查2数据", "提示", {
          confirmButtonText: "确定",
        });
      } else {
        this.qualityProdFoodsafetySubList.splice(
          this.checkedQualityProdFoodsafetySub[0].index - 1,
          1
        );
      }
    },
    /* 初始化表头 */
    initTable() {
      for (
        var index = 0;
        index < this.qualityProdFoodsafetySubList.length;
        index++
      ) {
        this.qualityProdFoodsafetySubList[index].nr = "";
        if (index <= 16) {
          this.qualityProdFoodsafetySubList[index].nr =
            "原辅料（包括食品原料、食品添加剂、食品相关产品）采购进货查验落实情况。";
        } else if (index <= 58) {
          this.qualityProdFoodsafetySubList[index].nr = "生产过程控制";
        } else if (index <= 85) {
          this.qualityProdFoodsafetySubList[index].nr = "出厂检验现场检查";
        }

        this.qualityProdFoodsafetySubList[index].jcxm = "";
        if (index <= 6) {
          this.qualityProdFoodsafetySubList[index].jcxm = "1.原辅料存放";
        } else if (index <= 9) {
          this.qualityProdFoodsafetySubList[index].jcxm = "2.专库管理";
        } else if (index <= 11) {
          this.qualityProdFoodsafetySubList[index].jcxm = "3.标签标识";
        } else if (index <= 13) {
          this.qualityProdFoodsafetySubList[index].jcxm = "4.索证";
        } else if (index <= 14) {
          this.qualityProdFoodsafetySubList[index].jcxm = "5.制度具备情况";
        } else if (index <= 17) {
          this.qualityProdFoodsafetySubList[index].jcxm = "6.现场记录";
        } else if (index <= 22) {
          this.qualityProdFoodsafetySubList[index].jcxm =
            "1.厂区环境清洁卫生状况";
        } else if (index <= 27) {
          this.qualityProdFoodsafetySubList[index].jcxm = "2.卫生间、更衣室";
        } else if (index <= 33) {
          this.qualityProdFoodsafetySubList[index].jcxm =
            "3.生产加工场所清洁卫生状况、工作纪律";
        } else if (index <= 35) {
          this.qualityProdFoodsafetySubList[index].jcxm =
            "4.生产加工设施、设备清洁卫生状况";
        } else if (index <= 37) {
          this.qualityProdFoodsafetySubList[index].jcxm =
            "5.企业必备生产设备、设施维护保养和清洗消毒";
        } else if (index <= 39) {
          this.qualityProdFoodsafetySubList[index].jcxm = "6.产品投料记录";
        } else if (index <= 41) {
          this.qualityProdFoodsafetySubList[index].jcxm =
            "7.生产工艺和生产加工过程中关键控制点的控制记录";
        } else if (index <= 46) {
          this.qualityProdFoodsafetySubList[index].jcxm =
            "8.生产中人流、物流交叉污染情况；原料、半成品、成品交叉污染情况";
        } else if (index <= 50) {
          this.qualityProdFoodsafetySubList[index].jcxm =
            "9.设备、设施运行情况";
        } else if (index <= 55) {
          this.qualityProdFoodsafetySubList[index].jcxm = "10.从业人员管理情况";
        } else if (index <= 59) {
          this.qualityProdFoodsafetySubList[index].jcxm = "11.回收食品处置情况";
        } else if (index <= 66) {
          this.qualityProdFoodsafetySubList[index].jcxm =
            "1.检验室设施、设备、化学试剂情况";
        } else if (index <= 68) {
          this.qualityProdFoodsafetySubList[index].jcxm =
            "2.应具备相应能力的检验员";
        } else if (index <= 71) {
          this.qualityProdFoodsafetySubList[index].jcxm =
            "3.出厂销售成品是否具有出厂检验";
        } else if (index <= 73) {
          this.qualityProdFoodsafetySubList[index].jcxm = "4.产品留样情况";
        } else if (index <= 77) {
          this.qualityProdFoodsafetySubList[index].jcxm =
            "5.成品库成品存放是否符合要求";
        } else if (index <= 79) {
          this.qualityProdFoodsafetySubList[index].jcxm = "6.标识标注情况";
        } else if (index <= 90) {
          this.qualityProdFoodsafetySubList[index].jcxm =
            "7.不合格品管理和不安全食品召回情况";
        }
      }
    },
    /** 单选框选中数据 */
    handleQualityProdFoodsafetySubSelectionChange(selection) {
      if (selection.length > 1) {
        this.$refs.qualityProdFoodsafetySub.clearSelection();
        this.$refs.qualityProdFoodsafetySub.toggleRowSelection(selection.pop());
      } else {
        this.checkedQualityProdFoodsafetySub = selection;
      }
    },
    excelhandleView(row){
      //Boolean isVertical,int isTitle,Boolean autoAddLine
      //isVertical:true为竖表；false为横表。竖表时isTitle和autoAddLine参数无意义
      //isTitle:1为自动添加标题，{+sub_startlog+}所在行为标题；0为不添加标题，{+sub_startlog+}所在行为第一条数据。
      //autoAddLine:true为自动添加新行；false不添加新行。
      this.download(
        "Productionline/foodsafety/exportexcel?isVertical=false&isTitle=0&autoAddLine=false&id="+row.id,
        {
          ...this.queryParams,
        },
        "食品安全自查表" + this.parseTime(new Date()) + ".xlsx"
      );
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "Productionline_foodsafety/foodsafety/export",
        {
          ...this.queryParams,
        },
        "食品安全自查" + this.parseTime(new Date()) + ".xlsx"
      );
    },
    //接收编号
    nameChange(e) {
      this.form.bbbh = e;
    },
  },
};
</script>
<style lang="scss">
.vx_table_box {
  width: 100%;
  height: 45vh;
  position: relative;
  display: flex;
  overflow-x: auto;
  transform: translate(0, 0);

  .fiexd {
    left: 0;
    background: rgba(9, 59, 118, 0.9);
    /* height:auto; */
    // z-index:2;
    z-index: 2000;
    position: sticky;
  }
  .dit_box_cloumn {
    .item {
      width: 230px;
      height: 48px;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0 15px;
      border: 1px solid rgba(31, 179, 255, 0.2) !important;
      //  border-right:1px solid rgba(31, 179, 255, 0.2)!important;
    }
  }
}
.float {
  float: left;
}
.el-dialog.is-fullscreen {
  .vx_table_box {
    width: 100%;
    height: 65vh;
  }
}
</style>
